package parserUML;


/**
 * 
 */
import java.io.Serializable;
import java.util.*;
 
/**
 * @author Guillaume Chapuis
 */
public class ClassObject extends JavaObject implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 8535611807735261292L;
	/**
	 * list of the class' methods
	 */
	public ArrayList<MethodObject> methods;
	/**
	 * list of the class' fields
	 */
	public ArrayList<AttributeObject> attributes;
	/**
	 * list of the interfaces that the current class implements
	 */
	public ArrayList<String> implemented;
	/**
	 * classe that the current class extends
	 */
	public String extended;
	public String internal;
	
	public ClassObject(String sName){
		super(sName);
		methods = new ArrayList<MethodObject>();
		attributes = new ArrayList<AttributeObject>();
		implemented = new ArrayList<String>();
	}
	
	public String toString(){
		String res="";
		if(!this.modifiers.isEmpty()){
			res = "(";
			for(String mod: modifiers){
				res += mod + ", ";
			}
			res = res.substring(0, res.length()-2) + ") ";
		}
		res += this.getName()+"\n\n";
		for(AttributeObject att : attributes){
			res+=att.toString()+"\n";
		}
		res+="\n";
		for(MethodObject meth : methods){
			res+=meth.toString()+"\n";
		}
		return res;
	}


	@Override
	public boolean equals(Object arg0) {
		return super.equals(arg0);
	}

	@Override
	public int hashCode() {
		return super.hashCode();
	}
	
}
